package com.jt.provider.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
 * 构建controller 对象,用于server的值*/
@RestController
public class ProviderController {
    @Value("${server.port:8080}")
    private String server;
    /**
     * 从项目配置文件中读取server.port的值,然后赋值给serverPort属性,
     * 冒号右边的8080为一个默认值,假如从配置文件读取不到server.port
     * ,此时会将默认值赋值给属性serverPort*/
    @GetMapping("/provider/echo/{msg}")
    public String doRestEcho1(@PathVariable("msg") String msg){

        return server+"say hello"+msg;
    }
}
